import random

from ua_info import  ua_list
from urllib import request
from urllib import parse

url ='https://img1.baidu.com/it/u=3447111418,3888687176&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1428'

headers={
    'User-Agent': random.choice(ua_list),
}

# req = request.Request(headers=headers,url=url)
# res = request.urlopen(req)
# response = res.read()
# with open('tiger.jpg','wb') as f:
#     f.write(response)


html='''
    <li class="imgitem" style="width: 204px; height: 188px; margin-bottom: 8px;" data-objurl="https://www.scsqw.cn/upload/main/contentmanage/article/image/2024/07/29/f9be1d542400420cb019e974556b36d1.jpeg" data-shitutoken="a44ada" data-thumburl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500"
        data-fromurl="http://www.scsqw.cn/gzdt/zyhy/content_154168" data-fromjumpurl="http://www.scsqw.cn/gzdt/zyhy/content_154168" data-fromurlhost="www.scsqw.cn" data-ext="jpeg" data-saved="0" pn="0" data-pi="0" data-specialtype="0" data-cs="2687444464,4093651647"
        data-width="1152" data-height="896" data-hostname="" data-title="c视觉·了不起生灵(59)丨全球<strong>老虎</strong>日 ai画虎六虎送福" data-personalized="0" data-partnerid="0" data-type="jpeg" data-iscopyright="0" data-bigimgurl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500">
        <div class="imgbox" style="height: 160px; background-color: rgb(102, 160, 138);">
            <div class="imgbox-inner-border"></div>
            <div class="imgbox-border">
                <a href="/search/detail?ct=503316480&amp;z=&amp;tn=baiduimagedetail&amp;ipn=d&amp;word=%E8%80%81%E8%99%8E&amp;step_word=&amp;lid=7743147505986636828&amp;ie=utf-8&amp;in=&amp;cl=2&amp;lm=-1&amp;st=-1&amp;hd=&amp;latest=&amp;copyright=&amp;cs=2687444464,4093651647&amp;os=10619952,1173093574&amp;simid=4192182619,749820564&amp;pn=0&amp;rn=1&amp;di=7445700328764211201&amp;ln=1463&amp;fr=&amp;fmq=1735561062013_R&amp;fm=result&amp;ic=&amp;s=undefined&amp;se=&amp;sme=&amp;tab=0&amp;width=&amp;height=&amp;face=undefined&amp;is=0,0&amp;istype=2&amp;ist=&amp;jit=&amp;bdtype=0&amp;spn=0&amp;pi=0&amp;gsm=1e&amp;objurl=https%3A%2F%2Fwww.scsqw.cn%2Fupload%2Fmain%2Fcontentmanage%2Farticle%2Fimage%2F2024%2F07%2F29%2Ff9be1d542400420cb019e974556b36d1.jpeg&amp;rpstart=0&amp;rpnum=0&amp;adpicid=0&amp;nojc=undefined&amp;dyTabStr=MCwxMiwzLDEsMiwxMyw3LDYsNSw5"
                    target="_blank" style="display: block; width: 204px; height: 160px;" name="pn0" class="div_2687444464,4093651647"><img class="main_img img-hover" data-show-ext="{&quot;order&quot;:48,&quot;url&quot;:&quot;https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500&quot;,&quot;cs&quot;:&quot;2687444464,4093651647&quot;,&quot;strategy&quot;:&quot;78652273_632000_0_0&quot;}"
                        data-imgurl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500" src="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500"
                        style="width: 204px; height: 160px;"></a>
            </div>
        </div><a class="imgitem-title div_2687444464,4093651647" target="_blank" title="c视觉·了不起生灵(59)丨全球老虎日 ai画虎六虎送福" href="/search/detail?ct=503316480&amp;z=&amp;tn=baiduimagedetail&amp;ipn=d&amp;word=%E8%80%81%E8%99%8E&amp;step_word=&amp;lid=7743147505986636828&amp;ie=utf-8&amp;in=&amp;cl=2&amp;lm=-1&amp;st=-1&amp;hd=&amp;latest=&amp;copyright=&amp;cs=2687444464,4093651647&amp;os=10619952,1173093574&amp;simid=4192182619,749820564&amp;pn=0&amp;rn=1&amp;di=7445700328764211201&amp;ln=1463&amp;fr=&amp;fmq=1735561062013_R&amp;fm=result&amp;ic=&amp;s=undefined&amp;se=&amp;sme=&amp;tab=0&amp;width=&amp;height=&amp;face=undefined&amp;is=0,0&amp;istype=2&amp;ist=&amp;jit=&amp;bdtype=0&amp;spn=0&amp;pi=0&amp;gsm=1e&amp;objurl=https%3A%2F%2Fwww.scsqw.cn%2Fupload%2Fmain%2Fcontentmanage%2Farticle%2Fimage%2F2024%2F07%2F29%2Ff9be1d542400420cb019e974556b36d1.jpeg&amp;rpstart=0&amp;rpnum=0&amp;adpicid=0&amp;nojc=undefined&amp;dyTabStr=MCwxMiwzLDEsMiwxMyw3LDYsNSw5"
            name="pn0" style="width: 188px;">c视觉·了不起生灵(59)丨全球老虎日 ai画虎六虎送福</a>


    </li>    
    <li class="imgitem" style="width: 204px; height: 188px; margin-bottom: 8px;" data-objurl="https://www.scsqw.cn/upload/main/contentmanage/article/image/2024/07/29/f9be1d542400420cb019e974556b36d1.jpeg" data-shitutoken="a44ada" data-thumburl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500"
        data-fromurl="http://www.scsqw.cn/gzdt/zyhy/content_154168" data-fromjumpurl="http://www.scsqw.cn/gzdt/zyhy/content_154168" data-fromurlhost="www.scsqw.cn" data-ext="jpeg" data-saved="0" pn="0" data-pi="0" data-specialtype="0" data-cs="2687444464,4093651647"
        data-width="1152" data-height="896" data-hostname="" data-title="c视觉·了不起生灵(59)丨全球<strong>老虎</strong>日 ai画虎六虎送福" data-personalized="0" data-partnerid="0" data-type="jpeg" data-iscopyright="0" data-bigimgurl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500">
        <div class="imgbox" style="height: 160px; background-color: rgb(102, 160, 138);">
            <div class="imgbox-inner-border"></div>
            <div class="imgbox-border">
                <a href="/search/detail?ct=503316480&amp;z=&amp;tn=baiduimagedetail&amp;ipn=d&amp;word=%E8%80%81%E8%99%8E&amp;step_word=&amp;lid=7743147505986636828&amp;ie=utf-8&amp;in=&amp;cl=2&amp;lm=-1&amp;st=-1&amp;hd=&amp;latest=&amp;copyright=&amp;cs=2687444464,4093651647&amp;os=10619952,1173093574&amp;simid=4192182619,749820564&amp;pn=0&amp;rn=1&amp;di=7445700328764211201&amp;ln=1463&amp;fr=&amp;fmq=1735561062013_R&amp;fm=result&amp;ic=&amp;s=undefined&amp;se=&amp;sme=&amp;tab=0&amp;width=&amp;height=&amp;face=undefined&amp;is=0,0&amp;istype=2&amp;ist=&amp;jit=&amp;bdtype=0&amp;spn=0&amp;pi=0&amp;gsm=1e&amp;objurl=https%3A%2F%2Fwww.scsqw.cn%2Fupload%2Fmain%2Fcontentmanage%2Farticle%2Fimage%2F2024%2F07%2F29%2Ff9be1d542400420cb019e974556b36d1.jpeg&amp;rpstart=0&amp;rpnum=0&amp;adpicid=0&amp;nojc=undefined&amp;dyTabStr=MCwxMiwzLDEsMiwxMyw3LDYsNSw5"
                    target="_blank" style="display: block; width: 204px; height: 160px;" name="pn0" class="div_2687444464,4093651647"><img class="main_img img-hover" data-show-ext="{&quot;order&quot;:48,&quot;url&quot;:&quot;https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500&quot;,&quot;cs&quot;:&quot;2687444464,4093651647&quot;,&quot;strategy&quot;:&quot;78652273_632000_0_0&quot;}"
                        data-imgurl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500" src="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500"
                        style="width: 204px; height: 160px;"></a>
            </div>
        </div><a class="imgitem-title div_2687444464,4093651647" target="_blank" title="c视觉·了不起生灵(59)丨全球老虎日 ai画虎六虎送福" href="/search/detail?ct=503316480&amp;z=&amp;tn=baiduimagedetail&amp;ipn=d&amp;word=%E8%80%81%E8%99%8E&amp;step_word=&amp;lid=7743147505986636828&amp;ie=utf-8&amp;in=&amp;cl=2&amp;lm=-1&amp;st=-1&amp;hd=&amp;latest=&amp;copyright=&amp;cs=2687444464,4093651647&amp;os=10619952,1173093574&amp;simid=4192182619,749820564&amp;pn=0&amp;rn=1&amp;di=7445700328764211201&amp;ln=1463&amp;fr=&amp;fmq=1735561062013_R&amp;fm=result&amp;ic=&amp;s=undefined&amp;se=&amp;sme=&amp;tab=0&amp;width=&amp;height=&amp;face=undefined&amp;is=0,0&amp;istype=2&amp;ist=&amp;jit=&amp;bdtype=0&amp;spn=0&amp;pi=0&amp;gsm=1e&amp;objurl=https%3A%2F%2Fwww.scsqw.cn%2Fupload%2Fmain%2Fcontentmanage%2Farticle%2Fimage%2F2024%2F07%2F29%2Ff9be1d542400420cb019e974556b36d1.jpeg&amp;rpstart=0&amp;rpnum=0&amp;adpicid=0&amp;nojc=undefined&amp;dyTabStr=MCwxMiwzLDEsMiwxMyw3LDYsNSw5"
            name="pn0" style="width: 188px;">c视觉·了不起生灵(59)丨全球老虎日 ai画虎六虎送福</a>


    </li>    
    <li class="imgitem" style="width: 204px; height: 188px; margin-bottom: 8px;" data-objurl="https://www.scsqw.cn/upload/main/contentmanage/article/image/2024/07/29/f9be1d542400420cb019e974556b36d1.jpeg" data-shitutoken="a44ada" data-thumburl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500"
        data-fromurl="http://www.scsqw.cn/gzdt/zyhy/content_154168" data-fromjumpurl="http://www.scsqw.cn/gzdt/zyhy/content_154168" data-fromurlhost="www.scsqw.cn" data-ext="jpeg" data-saved="0" pn="0" data-pi="0" data-specialtype="0" data-cs="2687444464,4093651647"
        data-width="1152" data-height="896" data-hostname="" data-title="c视觉·了不起生灵(59)丨全球<strong>老虎</strong>日 ai画虎六虎送福" data-personalized="0" data-partnerid="0" data-type="jpeg" data-iscopyright="0" data-bigimgurl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500">
        <div class="imgbox" style="height: 160px; background-color: rgb(102, 160, 138);">
            <div class="imgbox-inner-border"></div>
            <div class="imgbox-border">
                <a href="/search/detail?ct=503316480&amp;z=&amp;tn=baiduimagedetail&amp;ipn=d&amp;word=%E8%80%81%E8%99%8E&amp;step_word=&amp;lid=7743147505986636828&amp;ie=utf-8&amp;in=&amp;cl=2&amp;lm=-1&amp;st=-1&amp;hd=&amp;latest=&amp;copyright=&amp;cs=2687444464,4093651647&amp;os=10619952,1173093574&amp;simid=4192182619,749820564&amp;pn=0&amp;rn=1&amp;di=7445700328764211201&amp;ln=1463&amp;fr=&amp;fmq=1735561062013_R&amp;fm=result&amp;ic=&amp;s=undefined&amp;se=&amp;sme=&amp;tab=0&amp;width=&amp;height=&amp;face=undefined&amp;is=0,0&amp;istype=2&amp;ist=&amp;jit=&amp;bdtype=0&amp;spn=0&amp;pi=0&amp;gsm=1e&amp;objurl=https%3A%2F%2Fwww.scsqw.cn%2Fupload%2Fmain%2Fcontentmanage%2Farticle%2Fimage%2F2024%2F07%2F29%2Ff9be1d542400420cb019e974556b36d1.jpeg&amp;rpstart=0&amp;rpnum=0&amp;adpicid=0&amp;nojc=undefined&amp;dyTabStr=MCwxMiwzLDEsMiwxMyw3LDYsNSw5"
                    target="_blank" style="display: block; width: 204px; height: 160px;" name="pn0" class="div_2687444464,4093651647"><img class="main_img img-hover" data-show-ext="{&quot;order&quot;:48,&quot;url&quot;:&quot;https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500&quot;,&quot;cs&quot;:&quot;2687444464,4093651647&quot;,&quot;strategy&quot;:&quot;78652273_632000_0_0&quot;}"
                        data-imgurl="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500" src="https://img2.baidu.com/it/u=3602062415,2788378423&amp;fm=253&amp;fmt=auto&amp;app=120&amp;f=JPEG?w=643&amp;h=500"
                        style="width: 204px; height: 160px;"></a>
            </div>
        </div><a class="imgitem-title div_2687444464,4093651647" target="_blank" title="c视觉·了不起生灵(59)丨全球老虎日 ai画虎六虎送福" href="/search/detail?ct=503316480&amp;z=&amp;tn=baiduimagedetail&amp;ipn=d&amp;word=%E8%80%81%E8%99%8E&amp;step_word=&amp;lid=7743147505986636828&amp;ie=utf-8&amp;in=&amp;cl=2&amp;lm=-1&amp;st=-1&amp;hd=&amp;latest=&amp;copyright=&amp;cs=2687444464,4093651647&amp;os=10619952,1173093574&amp;simid=4192182619,749820564&amp;pn=0&amp;rn=1&amp;di=7445700328764211201&amp;ln=1463&amp;fr=&amp;fmq=1735561062013_R&amp;fm=result&amp;ic=&amp;s=undefined&amp;se=&amp;sme=&amp;tab=0&amp;width=&amp;height=&amp;face=undefined&amp;is=0,0&amp;istype=2&amp;ist=&amp;jit=&amp;bdtype=0&amp;spn=0&amp;pi=0&amp;gsm=1e&amp;objurl=https%3A%2F%2Fwww.scsqw.cn%2Fupload%2Fmain%2Fcontentmanage%2Farticle%2Fimage%2F2024%2F07%2F29%2Ff9be1d542400420cb019e974556b36d1.jpeg&amp;rpstart=0&amp;rpnum=0&amp;adpicid=0&amp;nojc=undefined&amp;dyTabStr=MCwxMiwzLDEsMiwxMyw3LDYsNSw5"
            name="pn0" style="width: 188px;">c视觉·了不起生灵(59)丨全球老虎日 ai画虎六虎送福</a>


    </li>    
'''

import re

# result = re.findall('<li.*?</li>',html,re.DOTALL)
# # print(result[0])
result2 = re.findall('<li.*?bigimgurl="(.*?)".*?</li>',html,re.DOTALL)
 